<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>意见反馈</title>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <style>
        body {
            font-family: Arial, sans-serif;
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
            background-color: #fff9e6;
        }
        
        .feedback-container {
            background: white;
            padding: 30px;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        
        .page-title {
            color: #5c3c10;
            text-align: center;
            margin-bottom: 30px;
            font-size: 24px;
        }
        
        .feedback-type {
            margin-bottom: 20px;
        }
        
        .type-options {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            margin-bottom: 20px;
        }
        
        .type-option {
            background: #ffe4b5;
            border: 2px solid transparent;
            padding: 8px 15px;
            border-radius: 20px;
            cursor: pointer;
            color: #5c3c10;
        }
        
        .type-option.active {
            background: #ffd700;
            border-color: #5c3c10;
            font-weight: bold;
        }
        
        textarea {
            width: 100%;
            height: 150px;
            padding: 15px;
            border: 1px solid #ddd;
            border-radius: 8px;
            margin-bottom: 20px;
            resize: vertical;
        }
        
        .contact-input {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            margin-bottom: 20px;
        }
        
        .submit-btn {
            background: #ffd700;
            color: #5c3c10;
            border: none;
            padding: 12px 30px;
            border-radius: 25px;
            cursor: pointer;
            font-size: 16px;
            width: 100%;
            font-weight: bold;
        }
        
        .submit-btn:hover {
            background: #ffed4a;
        }
        
        .success-message {
            text-align: center;
            color: #4CAF50;
            margin-top: 20px;
            display: none;
        }
        
        label {
            display: block;
            margin-bottom: 8px;
            color: #5c3c10;
            font-weight: bold;
        }
    </style>
</head>
<body>
    <div class="feedback-container">
        <h1 class="page-title">意见反馈</h1>
        
        <div class="feedback-type">
            <label>反馈类型</label>
            <div class="type-options">
                <div class="type-option active" data-type="bug">功能异常</div>
                <div class="type-option" data-type="suggestion">功能建议</div>
                <div class="type-option" data-type="complaint">投诉举报</div>
                <div class="type-option" data-type="other">其他</div>
            </div>
        </div>
        
        <div class="feedback-content">
            <label>反馈内容</label>
            <textarea id="feedbackContent" placeholder="请详细描述您的问题或建议..."></textarea>
        </div>
        
        <div class="contact-info">
            <label>联系方式（选填）</label>
            <input type="text" class="contact-input" id="contactInfo" placeholder="请留下您的手机号或邮箱，方便我们及时回复">
        </div>
        
        <button class="submit-btn" onclick="submitFeedback()">提交反馈</button>
        
        <div class="success-message">
            感谢您的反馈，我们会认真处理！
        </div>
    </div>

    <script>
    $(document).ready(function() {
        $('.type-option').click(function() {
            $('.type-option').removeClass('active');
            $(this).addClass('active');
        });
    });

    function submitFeedback() {
        const feedbackData = {
            type: $('.type-option.active').data('type'),
            content: $('#feedbackContent').val().trim(),
            contact: $('#contactInfo').val().trim()
        };
        
        if (!feedbackData.content) {
            alert('请填写反馈内容');
            return;
        }
        
        $.ajax({
            url: '/feedback/submit',
            type: 'POST',
            contentType: 'application/json',
            data: JSON.stringify(feedbackData),
            success: function(response) {
                if (response.code === 200) {
                    $('.success-message').fadeIn();
                    $('#feedbackContent').val('');
                    $('#contactInfo').val('');
                    setTimeout(() => {
                        $('.success-message').fadeOut();
                    }, 3000);
                } else {
                    alert('提交失败：' + response.message);
                }
            },
            error: function() {
                alert('提交失败，请稍后重试');
            }
        });
    }
    </script>
</body>
</html> 